package com.myk.game.sumeru.game;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;

import com.myk.game.lib.DrawBuffer;
import com.myk.game.lib.utils.BitmapUtil;
import com.myk.game.sumeru.R;
import com.myk.game.sumeru.interfaces.IGame;

/**
 * 棋子基类
 */
public abstract class Chess {

    /**
     * 表示中立棋子
     */
    public static final int MID = 0;
    /**
     * 表示己方棋子
     */
    public static final int OWN = 1;
    /**
     * 表示对方棋子
     */
    public static final int OTH = 2;

    public final String NAME;   //棋子名称
    public final String DESCRIPTION; //能力描述
    public final int STRENGTH; //原始战力
    public final int VELOCITY; //原始移速
    public final int RES; //图像资源
    private IGame game; //当前游戏环境
    private int party; //棋子归属 0：中立，1：己方，2：对方
    private int[] strengthBuffList; //当前战力buff列表
    private int[] velocityBuffList; //当前移速buff列表
    private Grid position; //当前所在位置
    private ChessBeClickEvent beClickEvent; //棋子被点击时触发的事件

    public Chess(String NAME, String DESCRIPTION, int STRENGTH, int VELOCITY, int RES) {
        this.NAME = NAME;
        this.DESCRIPTION = DESCRIPTION;
        this.STRENGTH = STRENGTH;
        this.VELOCITY = VELOCITY;
        this.RES = RES;
    }

    public void setGame(IGame game) {
        this.game = game;
    }

    public void setBeClickEvent(ChessBeClickEvent beClickEvent) {
        this.beClickEvent = beClickEvent;
    }

    public void notifyBeClickEvent() {
        if (beClickEvent != null) {
            beClickEvent.beClickEvent();
        }
    }

    public int getParty() {
        return party;
    }

    public void setParty(int party) {
        this.party = party;
    }

    public Grid getPosition() {
        return position;
    }

    public void setPosition(Grid position) {
        this.position = position;
    }

    public int getStrength() {
        return STRENGTH;
    }

    public int getStrengthColor() {
        return 0xFF000000;
    }

    public int getVelocity() {
        return VELOCITY;
    }

    public int getVelocityColor() {
        return 0xFF000000;
    }

    public interface ChessBeClickEvent {
        void beClickEvent();
    }
}
